package com.yugao.fintech.antelope.infra.module.group.model.rqrs;

import com.yugao.fintech.framework.assistant.utils.tree.TreeNode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

/**
 * 通用数据组
 *

 */
@Getter
@Setter
@ApiModel(value = "查询通用数据组树")
public class DataGroupTreeResp extends DataGroupResp implements TreeNode<Long, DataGroupTreeResp> {
    @ApiModelProperty(value = "父id")
    private Long parentId;

    @ApiModelProperty(value = "子节点数据")
    private List<DataGroupTreeResp> children;


    /**
     * 前端数据树中的key
     */
    public String getKey() {
        return String.valueOf(this.id);
    }

    /**
     * 前端数据树中的value
     */
    public String getValue() {
        return String.valueOf(this.id);
    }

    /**
     * 前端数据树中的title
     */
    public String getTitle() {
        return this.getName();
    }

    @Override
    public Long treeId() {
        return this.id;
    }

    @Override
    public void treeId(Long id) {
        this.id = id;
    }

    @Override
    public Long treeParentId() {
        return this.parentId;
    }

    @Override
    public void treeParentId(Long parentId) {
        this.parentId = parentId;
    }

    @Override
    public List<DataGroupTreeResp> children() {
        return this.children;
    }

    @Override
    public String name() {
        return this.getName();
    }

    @Override
    public void children(List<DataGroupTreeResp> children) {
        this.children = children;
    }

    @Override
    public Integer sortNo() {
        return super.getSortNo();
    }
}
